CROSS_COMPILE	:=
TARGET			:= write read netlink_test
CC				:= $(CROSS_COMPILE)gcc
CFLAGS			:= -Wall -g

OBJCOPY			:= $(CROSS_COMPILE)objcopy
OBJDUMP			:= $(CROSS_COMPILE)objdump

INCDIRS			:= ./
SRCDIRS			:= ./

INCLUDE			:= $(patsubst %, -I %, $(INCDIRS))
SFILES			:= $(foreach dir, $(SRCDIRS), $(wildcard $(dir)/*.s))
CFILES			:= $(foreach dir, $(SRCDIRS), $(wildcard $(dir)/*.c))
SFILENDIRS		:= $(notdir $(SFILES))
CFILENDIRS		:= $(notdir $(CFILES))
SOBJS			:= $(patsubst %, obj/%, $(SFILENDIRS:.s=.o))
COBJS			:= $(patsubst %, obj/%, $(CFILENDIRS:.c=.o))
OBJS			:= $(SOBJS)$(COBJS)
VPATH			:= $(SRCDIRS)


all:$(TARGET)

$(TARGET):%:%.c
	$(shell mkdir -p ./obj)
	$(CC) $<  $(CFLAGS) -o $@

.PHONY : clean

clean:
	rm -rf $(TARGET)
	rm -rf *.o
